﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Istace.Framework.Mapping.Core;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Istace.Framework.Mapping.UnitTest
{
    [TestClass]
    public class MappingWithNullValueShouldThrowNullArgumentExceptions
    {
        [ExpectedException(typeof(ArgumentNullException), "When call a map method with null value, should throw null argument exception", AllowDerivedTypes = false)]
        [TestMethod]
        public void CallToMapWithDestinationWithoutArgumentShouldThrowNullArgumentExceptions()
        {
            Mapper.Initialize(this.GetType().Assembly, false, true);
            Mapper.Map<string>(null);
        }

        [ExpectedException(typeof(ArgumentNullException), "When call a map method with null value, should throw null argument exception", AllowDerivedTypes = false)]
        [TestMethod]
        public void CallToMapListWithDestinationWithoutArgumentShouldThrowNullArgumentExceptions()
        {
            Mapper.Initialize(this.GetType().Assembly, false, true);
            Mapper.MapList<string>(null).ToList();
        }

        [ExpectedException(typeof(ArgumentNullException), "When call a map method with null value, should throw null argument exception", AllowDerivedTypes = false)]
        [TestMethod]
        public void CallToMapWithDestinationAndSourceWithoutArgumentShouldThrowNullArgumentExceptions()
        {
            Mapper.Initialize(this.GetType().Assembly, false, true);
            Mapper.Map<B, string>(null);
        }

        [ExpectedException(typeof(ArgumentNullException), "When call a map method with null value, should throw null argument exception", AllowDerivedTypes = false)]
        [TestMethod]
        public void CallToMapListWithDestinationAndSourceWithoutArgumentShouldThrowNullArgumentExceptions()
        {
            Mapper.Initialize(this.GetType().Assembly, false, true);
            Mapper.MapList<B, string>(null).ToList();
        }
    }
}
